import request from '@/utils/request';
import type { HttpResult } from '@/api';
import type { AddSysTenant, EditSysTenant, SysTenant } from "./model.ts"

// 新增
export const add = async (data: AddSysTenant): Promise<HttpResult<SysTenant>> => {
  const res = await request.post<HttpResult<SysTenant>>(
    '/system/sysTenant/add',
    data,
  );
  return res.data;
};

// 删除
export const del = async (data: string[]): Promise<HttpResult<boolean>> => {
  const res = await request.post<HttpResult<boolean>>(
    '/system/sysTenant/delete',
    data,
  );
  return res.data;
};

// 修改
export const edit = async (data: EditSysTenant): Promise<HttpResult<boolean>> => {
  const res = await request.post<HttpResult<boolean>>(
    '/system/sysTenant/edit',
    data,
  );
  return res.data;
};

// 查询
export const query = async (id: string): Promise<HttpResult<SysTenant>> => {
  const res = await request.post<HttpResult<SysTenant>>(
    '/system/sysTenant/query?id=' + id
  );
  return res.data;
};

// 查询全部
export const queryList = async (): Promise<HttpResult<SysTenant>> => {
  const res = await request.post<HttpResult<SysTenant>>(
    '/system/sysTenant/queryList'
  );
  return res.data;
};

// 查询分页
export const queryPage = async (data: { pageNo: number, pageSize: number }): Promise<HttpResult<SysTenant>> => {
  const res = await request.post<HttpResult<SysTenant>>(
    '/system/sysTenant/queryPage',
    data
  );
  return res.data;
};

